package algorithms.leecode;

public class Au48 {
    public static void main(String[] args) {
        int[][] a = {{1,2,3,4,6},
                {5,6,7,8,9},
                {9,10,11,12,13},
                {13,14,15,16,17}};
        System.err.println(a[0][1]);
        rotate(a);
        System.err.println(a);
    }
    public static void rotate(int[][] matrix) {
        int len = matrix.length;
        int count = len / 2;
        for (int i = 0; i < count; i++) {
            for (int j = i; j < len - i - 1; j++) {
                int tmp = matrix[i][j];
                matrix[i][j] = matrix[len - 1 - j][i];
                matrix[len - 1 - j][i] = matrix[len - 1 - i][len -1 - j];
                matrix[len - 1 - i][len -1 - j] = matrix[j][len - 1- i];
                matrix[j][len - 1- i] = tmp;
            }
        }

    }
}
